package com.example.demo01.Controller.webController;

import com.alibaba.fastjson.JSON;
import com.example.demo01.Service.webService.AdminUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AdminUserController {

    @Autowired
    private AdminUserService adminUserService;

    /**
     * 验证账户是否有效:通过账户名称
     * */

    @RequestMapping("/login/GET/byaccount")
    public String validAccounrByAccount(
            @RequestParam( value = "account", required = false, defaultValue = "")String account,
            @RequestParam( value = "password", required = false, defaultValue = "")String password){
        return JSON.toJSONString(adminUserService.validAccounrByAccount(account,password));
    }

    /**
     * 验证账户是否有效:通过手机号
     * */
    @RequestMapping("/login/GET/byphonenum")
    public String validAccounrByPhoneNum(
            @RequestParam(value = "phoneNum",required = false,defaultValue = "") String phoneNum,
            @RequestParam(value = "password",required = false,defaultValue = "") String password){
        return JSON.toJSONString(adminUserService.validAccounrByPhoneNum(phoneNum,password));
    }

}
